import 'package:flutter/material.dart';

import 'listData.dart';

class ListViewTestPage extends StatelessWidget {
  const ListViewTestPage({Key? key}) : super(key: key);
// This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.yellow,
      ),
      home: Scaffold(
        appBar: AppBar(title: const Text("Flutter ICON")),
        body: MyHomePage(),
      ),
    );
  }

}
class MyHomePage extends StatelessWidget {
  List list = [];
  MyHomePage({Key? key}) : super(key: key) {
    for (var i = 0; i < Colors.primaries.length; i++) {
      list.add("我是一个列表--$i");
    }
  }
  @override
  Widget build(BuildContext context) {
    return ListView.builder(
        itemCount: list.length,
        itemBuilder: (context, index) {
          return Container(
            color: Colors.primaries[index][200],
            child: ListTile(
              title: Text("${list[index]}",
                selectionColor:  Colors.primaries[index],
                style: TextStyle(color:Colors.white ),
              ),
            ),
          );
        });
  }
}
